/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thread.demo.newpackage;

import sun.applet.AppletThreadGroup;

/**
 *
 * @author VANDH
 */
public class mainClass {

    public static void main(String[] args) throws InterruptedException, ClassNotFoundException {
//        stage2();
        int i = 60000;
        Integer j = new Integer(i);
        Integer k = new Integer(i - 1);
        System.out.println(j.compareTo(k));
        System.out.println(Math.sin(Math.PI / 2));
        Class c = Class.forName("thread.demo.newpackage.Radio");
        System.out.println(c.getSuperclass());
    }

    private static void stage2() {
        Radio radio1 = new Radio();
        Radio radio2 = new Radio();

        System.out.println(Radio.count);
        radio1.start();
        radio2.start();
        System.out.println(Radio.count);
    }

    private static void stage1() throws InterruptedException {
        // Chương trình chạy bắt đầu từ main
        Radio radio = new Radio();
        AirConditioner conditioner = new AirConditioner();

        //radio.setName("I'm Radio");
        System.out.println("main - Starting radio - " + radio.getName());
        radio.start(); // -> ready,r unning
        System.out.println("main - Radio will run in 3s");

        System.out.println("main - Starting air conditioner - ");
        Thread newThread = new Thread(conditioner);
        newThread.start();
        System.out.println("main - Air conditioner will run in 1s");

        // đang xử lí hàm main
        radio.join(5000);
        System.out.println("Radio isAlive() : " + radio.isAlive());

        // -> radio vô trạng thái ready, chạy hàm run trên Thread mới
    }
}
